﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;

namespace BLL
{
    /// <summary>
    /// BLL to Room table
    /// </summary>
    public class RoomBLL : DAL.RoomDAL
    {
        #region Contansts
        #endregion

        #region Objects
        #endregion

        #region Properties
        #endregion

        #region Constructors
        public RoomBLL() { }
        public RoomBLL(string connectString) : base(connectString) { }
        #endregion

        #region Implements
        #endregion

        #region Events
        #endregion

        #region Methods
        /// <summary>
        /// Get empty room
        /// </summary>
        /// <returns>Data</returns>
        public DataTable GetEmpty()
        {
            return Select(1); // Id's empty room
        }

        /// <summary>
        /// Lease room
        /// </summary>
        /// <returns>True is successfull else false</returns>
        public bool Lease(long id)
        {
            var o = new DAL.tb_Room() { Id = id, StatusId = 2 };
            if (UpdateStatus(o) == UTL.Session.PerState.Success)
                return true;
            return false;
        }

        /// <summary>
        /// Book room
        /// </summary>
        /// <returns>True is successfull else false</returns>
        public bool Book(long id)
        {
            var o = new DAL.tb_Room() { Id = id, StatusId = 4 };
            if (UpdateStatus(o) == UTL.Session.PerState.Success)
                return true;
            return false;
        }
        #endregion

        #region Overrides
        #endregion

        #region Statics
        #endregion

        #region More
        #endregion
    }
}